<?php
namespace app\index\controller;

use think\Controller;
use app\index\model\Dqgation;
use think\Db;
class Index extends Controller
{
    private $cModel;   //当前控制器关联模型

    public function _initialize()
    {
        //实例化modelDqgation的方法 ，然后使用$this-> ;调用
        $this->cModel = new Dqgation;
    }
        //重新定义一个方法，将公共的代码放在里面，然后使用$this-> ;调用
        public function getData()
    {
            $this->assign('name',Dqgation::select());
    }
    // index页面方法
        public function index()
    {
        $this->getData();
        // 显示合作伙伴
        //判断查询的数据是否满where条件
        $data =Db:: table('tf_dqpic')->where("status",1)->select();
        $this->assign('data',$data);
        //var_dump($data);
        //循环遍历电影
        $datadiyi=Db:: table('tf_dqdiyi')->where("status",1)->select();
        $this->assign('datadiyi',$datadiyi);
        //显示关于我们
        $dataabout=Db:: table('tf_dqabout')->select();
        $this->assign('dataabout',$dataabout);
        //显示经典视频
        $datajdys=Db:: table('tf_dqjdys')->select();
        $this->assign('datajdys',$datajdys);
        //显示新闻资讯
        $dataxwzx=Db:: table('tf_dqxwzx')->select();
        $this->assign('dataxwzx',$dataxwzx);
        return view("index/index");

     }
        public function guanyuyouzhan()
    {
        $this->getData();
        return view("guanyuyouzhan/guanyuyouzhan");
     }
        public function dianshiju()
    {
        //在common类里定义了selecttf_dqgation方法
        //selecttf_dqgation为值已name进行传值，在前台页面volist name=“name”
        $this->assign('name', selecttf_dqgation());
        // 显示电视剧
        $datadiyi=Db:: table('tf_dqdiyi')->where("status",1)->select();
        $this->assign('datadiyi',$datadiyi);
        return view("dianshiju/dianshiju");
    }

        public function hezuohuoban()
    {
        // 显示合作
        $this->getData();
        $data =Db:: table('tf_dqpic')->where("status",1)->select();
        $this->assign('data',$data);
        return view("hezuohuoban/hezuohuoban");
    }

        public function jingdiananli()
    {
        $this->getData();
        $datajdys=Db:: table('tf_dqjdys')->select();
        $this->assign('datajdys',$datajdys);
        return view ("jingdiananli/jingdiananli");
    }

        public function xinwenzixun()
    {
        $this->getData();
        //显示新闻资讯
        $dataxwzx=Db:: table('tf_dqxwzx')->select();
        $this->assign('dataxwzx',$dataxwzx);
        return view("xinwenzixun/xinwenzixun");
    }

        public function dianying()
    {
        $this->getData();
        //循环遍历电影
        $datadiyi=Db:: table('tf_dqdiyi')->where("status",1)->select();
        $this->assign('datadiyi',$datadiyi);
        return view("dianying/dianying");
    }

    public function xinwen()
    {
        $id=input('id');
        return view('16');
    }


}
